package com.gy.universities.service.impl;
import com.gy.universities.dao.StudyAdminMapper;
import com.gy.universities.entity.StudyAdmin;
import com.gy.universities.service.StudyAdminService;
//import com.alibaba.dubbo.config.annotation.Service;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.ArrayList;
import java.util.HashMap;

@Component
@Service/*(interfaceClass=StudyAdminService.class)*/
public class StudyAdminServiceImpl implements StudyAdminService {

    @Resource
    private StudyAdminMapper studyAdminMapper;

    public StudyAdmin getStudyAdminById(String id)throws Exception{
        return studyAdminMapper.getStudyAdminById(id);
    }

    public List<StudyAdmin>	getStudyAdminListByMap(Map<String,Object> param)throws Exception{
        return studyAdminMapper.getStudyAdminListByMap(param);
    }

    public Integer getStudyAdminCountByMap(Map<String,Object> param)throws Exception{
        return studyAdminMapper.getStudyAdminCountByMap(param);
    }

    public Integer qdtxAddStudyAdmin(StudyAdmin studyAdmin)throws Exception{
            //studyAdmin.setCreatedTime(new Date());
            return studyAdminMapper.insertStudyAdmin(studyAdmin);
    }

    public Integer qdtxModifyStudyAdmin(StudyAdmin studyAdmin)throws Exception{
        //studyAdmin.setUpdatedTime(new Date());
        return studyAdminMapper.updateStudyAdmin(studyAdmin);
    }

    public Integer qdtxDeleteStudyAdminById(String id)throws Exception{
        return studyAdminMapper.deleteStudyAdminById(id);
    }

    public Integer qdtxBatchDeleteStudyAdmin(String ids)throws Exception{
        Map<String,List<String>> param=new HashMap<String,List<String>>();
        String[] paramArrays=ids.split(",");
        List<String> idList=new ArrayList<String>();
            for (String temp:paramArrays){
                idList.add(temp);
            }
        param.put("ids",idList);
        return studyAdminMapper.batchDeleteStudyAdmin(param);
    }


}
